public class Demo {
    public static void main(String[] args) {
        mather matherboard =new mather();
        Mouse m =new Mouse();
        KeyBoard keyBoard=new KeyBoard();
        matherboard.install("mouse",m);
        matherboard.install("keyboard",keyBoard);
        matherboard.doWork();
        matherboard.WorkOff("mouse");
        matherboard.doWork();
        //现在需要安装一个打印机，但是不想生成文件，想用内部类去实现
        matherboard.install("printer",new IUSB(){
            @Override
            public void Power() {
                System.out.println("打印机上电");
            }

            @Override
            public void PowerOff() {
                System.out.println("打印机拔掉");
            }
        });
        matherboard.doWork();
        matherboard.WorkOff("printer");
        matherboard.doWork();


    }
}
